<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true" %>

<%@ page import="com.myfoon.action.backing.system.CountryBean"%>
<%@ page import="com.myfoon.model.entity.CountryName"%>
<%@ page import="java.util.List"%>
 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<fmt:setLocale value="${param['lang']}" scope="session"/>   
<c:if test="${param['lang'] != null}">
    <fmt:setLocale value="${param['lang']}" scope="session"/>   
</c:if>

<%     
    CountryBean countryBean = new CountryBean();
    System.out.println("REQUEST LOCALE " + request.getLocale());    
    System.out.println("SESSION LOCALE ----->" + session.getValue("lang"));
    
    List<CountryName> ctrList = countryBean.findAllByLang("en_US");
    request.setAttribute("ctrList", ctrList);    
%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link rel="stylesheet" type="text/css" href="/style/loginjsp.css"/>
        <link rel="stylesheet" type="text/css" href="/style/global.css"/>
        <script type="text/javascript">        
                                                          
        var hints = new Array('<fmt:message key="global.hint.email"/>',
                              '<fmt:message key="global.hint.password"/>',                              
                              '<fmt:message key="global.hint.name"/>');
                              
        var error = new Array('<fmt:message key="global.error.email"/>',
                              '<fmt:message key="global.error.password"/>',
                              '<fmt:message key="global.error.name"/>',
                              '',
                              '<fmt:message key="global.error.dateofbirth"/>',
                              '<fmt:message key="global.error.country"/>');        
        </script>
        <title>Myfoon</title>
    </head>
    <body>
        <div class="Login_TopBar">
            <div class="ml"></div>
             
            <div class="lng">
                <select class="f_fselect">
                    <option value="1">English</option>
                </select>
            </div>
        </div>
         
        <div class="Login_Content">
            <div class="LeftSide">
                <div>
                    <span class="Foon_sp1"><fmt:message key="global.whatismyfoon"/></span>
                     
                    <div></div>
                     
                    <div style="margin-top:8px"></div>
                     
                    <div></div>
                     
                    <div style="width: 350px">
                        <span class="Foon_sp3" style="width: 350px"><fmt:message key="global.slog1"/></span>
                    </div>
                </div>
                 
                <div style="margin-top:15px"></div>
                 
                <div class="img1"></div>
                 
                <div class="su">
                    <div class="hint" id="_form_su_err1" style="display: none;">                         
                        <div class="pointer"></div>
                    </div>                    
                     
                    <span class="Foon_sp2"><fmt:message key="global.signup"/></span>
                     
                    <div style="margin-top: 5px"></div>
                     
                    <div style="margin-left: 10px; height: 215px;">
                        <form method="POST" action="/accounts/Register">
                            <table cellspacing="0" cellpadding="0" border="0"
                                   summary="" width="100%">
                                <tbody>
                                    <tr>
                                        <td width="100px">
                                            <label class="f_sflabel" for="su_email"><fmt:message key="global.email"/></label>
                                        </td>
                                        <td>
                                            <input id="su_email" class="f_finput"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:3px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label class="f_sflabel"
                                                   for="su_password"><fmt:message key="global.password"/></label>
                                        </td>
                                        <td>
                                            <input id="su_password"
                                                   type="password"
                                                   class="f_finput"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:3px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label class="f_sflabel"
                                                   for="su_fullname"><fmt:message key="global.fullname"/></label>
                                        </td>
                                        <td>
                                            <input id="su_fullname"
                                                   class="f_finput"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:3px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label class="f_sflabel"
                                                   for="su_gender"><fmt:message key="global.gender"/></label>
                                        </td>
                                        <td>
                                            <select id="su_gender" class="f_fdefault" name="su_gender">
                                                <option value="0"><fmt:message key="global.gender.female"/></option>                                                
                                                <option value="1"><fmt:message key="global.gender.male"/></option>                                                
                                            </select>                                                                                        
                                        </td>
                                    </tr>         
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:3px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label class="f_sflabel"
                                                   for="su_dateofbirth"><fmt:message key="global.dateofbirth"/></label>
                                        </td>
                                        <td>
                                            <select id="su_month" class="f_fdefault" name="su_month">
                                                <option value="0"><fmt:message key="global.month"/></option>
                                                
                                                <c:forEach begin="1" end="12" var="month">
                                                    <option value="${month}"><fmt:message key="global.month.${month}"/></option>                                                
                                                </c:forEach>
                                            </select>                                                                                                                                                                    
                                            <select id="su_day" class="f_fdefault" name="su_day">
                                                <option value="0"><fmt:message key="global.day"/></option>
                                                
                                                <c:forEach begin="1" end="31" var="day">
                                                    <option value="${day}">${day}</option>                                                
                                                </c:forEach>                                                
                                            </select>                                                                                                                                                                    
                                            <select id="su_year" class="f_fdefault" name="su_year">
                                                <option value="0"><fmt:message key="global.year"/></option>                                                
                                                <% for(int i = 2000; i >= 1900; i--) { %>                                                 
                                                    <option value="<%= i %>"><%= i %></option>                                                
                                                <% } %>                                                                                                      
                                            </select>                                                                                                                                                                    
                                        </td>
                                    </tr>   
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:3px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <label class="f_sflabel"
                                                   for="su_country"><fmt:message key="global.country"/></label>
                                        </td>
                                        <td>
                                            <select id="su_country" class="f_fctr" name="su_country">
                                                <c:forEach var='ctr' items='${ctrList}'>                                                                                                    
                                                    <option value="${ctr.country.id}">${ctr.name}</option>
                                                </c:forEach>    
                                            </select>                                            
                                        </td>
                                    </tr>                                                                                                                                                
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:3px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <input type="submit" value="<fmt:message key="global.register"/>" ></input>
                                        </td>
                                    </tr>   
                                    <tr>
                                        <td></td>
                                        <td>
                                            <div style="margin-top:2px"></div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <span class="f_fplink">
                                                <a href="/accounts/TermsOfService"><fmt:message key="global.terms.accept"/></a>
                                            </span>
                                        </td>
                                    </tr>                                    
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
             
            <div class="RightSide">
                <span class="Foon_sp2"><fmt:message key="global.login1"/></span>             
                
                <div style="margin-top: 10px; margin-left: 10px;"> 
                    <form method="POST" action="/accounts/Login">
                        <table cellspacing="0" cellpadding="0" border="0"
                               width="100%" summary="">
                            <tbody>
                                <tr>
                                    <td>
                                        <label class="f_lflabel" for="email"><fmt:message key="global.email"/></label>
                                    </td>
                                    <td>
                                        <input id="email" class="f_finput" name="email"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <div style="margin-top:3px"></div>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <label class="f_lflabel" for="password"><fmt:message key="global.password"/></label>
                                    </td>
                                    <td>
                                        <input type="password" id="password" class="f_finput" name="password"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <div style="margin-top:3px"></div>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <input type="submit" value="<fmt:message key="global.login2"/>"></input>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <div style="margin-top:3px"></div>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <span class="f_fplink">
                                            <a href="/accounts/ForgotPassword"><fmt:message key="global.forgotpassword"/></a>
                                        </span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>                        
        </div>
        
        <div class="Login_TopBar">
            <div class="ml"></div>
             
            <div class="lng">
                <select class="f_fselect">
                    <option value="1">English</option>
                </select>
            </div>
        </div>        
    </body>
</html>